package com.huike.clues.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huike.clues.domain.SysOperLog;
import com.huike.clues.domain.dto.SysOperLogDTO;
import com.huike.clues.domain.dto.SysOperLogQueryDTO;
import com.huike.clues.mapper.SysOperLogMapper;
import com.huike.clues.service.ISysOperLogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;
@Service
public class ISysOperLogServiceImpl extends ServiceImpl<SysOperLogMapper, SysOperLog> implements ISysOperLogService {

    @Resource
    private SysOperLogMapper sysOperLogMapper;

    @Override
    public List<SysOperLog> getLogs(SysOperLogQueryDTO logDTO) {
        QueryWrapper<SysOperLog> queryWrapper = new QueryWrapper<>();
        queryWrapper.ge(logDTO.getBeginCreateTime() != null, "oper_time", logDTO.getBeginCreateTime())
                .le(logDTO.getEndCreateTime() != null, "oper_time", logDTO.getEndCreateTime())
                .like(logDTO.getKeyWord() != null, "title", logDTO.getKeyWord());

        List<SysOperLog> data = sysOperLogMapper.selectList(queryWrapper);
        return data;
    }

    @Override
    public List<SysOperLogDTO> selectOperLogList(SysOperLogDTO operLog) {
        return sysOperLogMapper.selectOperLogList(operLog);
    }
}
